import { useUserStore } from '/@/store/modules/user';
import { defHttp } from '/@/utils/http/axios';
import type { CooperRequestParamsType, CooperativeMessageDataResultWrapperType, IncomeDetailParamsType, ReceiptPaymentDetailParamsType, RemissionDetailDataParamsType } from '../../../types/business/reportforms'
import { ResultWrapperType } from '/#/axios';
const userStore = useUserStore()

export const getReportFormHeaderApi = (type: string | number) => {
  return defHttp.get({
    url: `/business/report/field/center/hotel/business?type=${type}&hotelId=${userStore.ParamSystem?.hotelId}`
  })
}

export const getReportFormDataApi = (month: string) => {
  return defHttp.get({
    url: `/business/report/center/hotel/business/data?hotelId=${userStore.ParamSystem?.hotelId}&month=${month}`
  })
}

export const putCheckBoxFieldsSelectApi = (data: any) => {
  return defHttp.put({
    url: `/business/report/field/center/hotel/business/edit/display`,
    data: {
      fields: data,
      hotelId: userStore.ParamSystem?.hotelId
    }
  })
}

export const putResetCheckboxSelectStatusApi = (type: string | number) => {
  return defHttp.put({
    url: `/business/report/field/center/hotel/business/param/reset?hotelId=${userStore.ParamSystem?.hotelId}&type=${type}`
  })
}

export const getPartnersAccountDataApi = (params: any) => {
  return defHttp.get({
    url: `/business/report/center/partners/account/detail/data`,
    params
  })
}

export const getAllChannelListApi = () => {
  return defHttp.get({
    url: `/business/channel/provider/all/list?hotelId=${userStore.ParamSystem?.hotelId}`,
  })
}

export const getPrePayReportFormByChannelApi = (params: any) => {
  return defHttp.get({
    url: `/business/report/center/channel/account/detail/data`,
    params
  })
}

export const getHoutelHousePriceReportFormsApi = (params: any) => {
  return defHttp.get({
    url: `/business/report/center/hotel/price/data?hotelId=${userStore.ParamSystem?.hotelId}`,
    params
  })
}

export const getHoutelStockReportFormsApi = (params: any) => {
  return defHttp.get({
    url: `/business/report/center/hotel/stock/data?hotelId=${userStore.ParamSystem?.hotelId}`,
    params
  })
}

// todo AI_范例：此处定义订单组件对应的接口地址
export const getOrderDetailReportFormsApi = (params: any) => {
  return defHttp.get({
    url: `/business/report/center/hotel/order/detail/data?hotelId=${userStore.ParamSystem?.hotelId}`,
    params
  })
}

// todo AI_生成：此处添加AR帐组件对应的接口地址


export const getReceiptPaymentCollectReportFormsApi = (params: any) => {
  return defHttp.get({
    url: `/business/report/center/hotel/posting/data?hotelId=${userStore.ParamSystem?.hotelId}`,
    params
  })
}


export const getReceiptExpendIncomeReportFormsApi = (params: any) => {
  return defHttp.get({
    url: `/business/report/center/hotel/consume/data?hotelId=${userStore.ParamSystem?.hotelId}`,
    params
  })
}


export const getReceiptPaymentDetailReportFormsApi = (params: ReceiptPaymentDetailParamsType) => {
  return defHttp.get({
    url: `/business/report/center/hotel/posting/detail/data?hotelId=${userStore.ParamSystem?.hotelId}`,
    params
  })
}

export const getPaymentMethodsListApi = (params?: { hotelId: string | number; status?: number }) => {
  return defHttp.get({
    url: `/business/pay/type/list`,
    params
  })
}

export const getHoutelRemissionDetailDataApi = (params: RemissionDetailDataParamsType) => {
  return defHttp.get({
    url: `/business/report/center/hotel/deduction/detail/data?hotelId=${userStore.ParamSystem?.hotelId}`,
    params
  })
}

export const getCooperativeMessageDataApi = (params?: CooperRequestParamsType) => {
  return defHttp.get<ResultWrapperType<CooperativeMessageDataResultWrapperType>>({
    url: `/business/report/center/hotel/partners/detail/data?hotelId=${userStore.ParamSystem?.hotelId}`,
    params
  })
}

export const getCheckOutDayDataApi = (day: string, operator?: string) => {
  return defHttp.get({
    url: `/business/report/center/hotel/checkout/data?hotelId=${userStore.ParamSystem?.hotelId}&checkoutDay=${day}`,
    params: {
      operator
    }
  })
}

export const getReceiptExpendIncomeDetailApi = (params: IncomeDetailParamsType) => {
  return defHttp.get({
    url: `/business/report/center/hotel/consume/detail/data?hotelId=${userStore.ParamSystem?.hotelId}` ,   
    params
  })
}

export const getReceiptAndPaymentListApi = () => {
  return defHttp.get({
    url: `/business/item/list?hotelId=${userStore.ParamSystem?.hotelId}`,
  })
}
